package com.example.fmgidsprototype;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import android.app.Application;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.NetworkInfo.State;

import com.example.fmgidsprototype.data.DataManager;
import com.example.fmgidsprototype.data.DataManagerImpl;
import com.example.fmgidsprototype.model.Category;
import com.example.fmgidsprototype.model.Venue;
import com.google.android.gms.maps.model.LatLng;

public class FmGidsPrototypeApp extends Application{
	
	private DataManager dataManager;
	private ConnectivityManager connManager;
	private int currentSelectedVenue;
	private List<Venue> allVenues;
	private List<Venue> categoryVenues;
	private List<Category> allCategories;
	private String selectedCategoryName;
	private LatLng llLastknownlocation;
	
	public DataManager getDataManager(){
		return this.dataManager;
	}
	
	public ConnectivityManager getConnectivityManager(){
		return this.connManager;
	}
	
	public void onCreate(){
		super.onCreate();
		connManager = (ConnectivityManager)this.getSystemService(Context.CONNECTIVITY_SERVICE);
		dataManager = new DataManagerImpl(this);
		allVenues = new ArrayList<Venue>();
		categoryVenues = new ArrayList<Venue>();
	}
	
	public boolean isConnected(){
		NetworkInfo netInfo = connManager.getActiveNetworkInfo();
		if((netInfo != null) && (netInfo.getState() != null)){
			return netInfo.getState().equals(State.CONNECTED);
		}
		return false;
	}
	
	public void setCurrentVenue(int current){
		this.currentSelectedVenue = current;
	}
	
	public int getCurrentSelectedVenue(){
		return this.currentSelectedVenue;
	}
	
	public void setVenues(List<Venue> allVenues){
		this.allVenues = allVenues;
	}
	
	public List<Venue> getAllVenues(){
		return this.allVenues;
	}
	
	public void setCategoryVenues(List<Venue> categoryVenues){
		this.categoryVenues = categoryVenues;
	}
	
	public List<Venue> getCategoryVenues(){
		return this.categoryVenues;
	}
	
	public void setAllCategories(List<Category> cats){
		this.allCategories = cats;
	}
	
	public List<Category> getAllCategories(){
		return this.allCategories;
	}
	
	public void setSelectedCategoryName(String name){
		this.selectedCategoryName = name;
	}
	
	public String getSelectedCategoryName(){
		return this.selectedCategoryName;
	}
	
	public void setLastLocation(LatLng loc){
		this.llLastknownlocation = loc;
	}
	
	public LatLng getLastLocation(){
		return this.llLastknownlocation;
	}

}
